void shell_sort(int array[], int length, int step)
{
    int inner = 0;
    int outer = 0;
    int median = 0;

    if(NULL == array || 0 == length)
        return;

    for(; step >= 1;step -= 2){
        for(int index = 0; index < step; index++){
            if((length-1) < (index + step)){
                continue;
            }
            else{
                outer = index + step;
                while((outer + step) <= (length-1)){
                    outer += step;
                }
            }

            for(; outer >= (index + step); outer -= step){
                for(inner = index; inner <= outer-step; inner += step){
                    if(array[inner] >= array[inner+step]){
                        median = array[inner];
                        array[inner] = array[inner+step];
                        array[inner+step] = median;
                    }
                }
            }
        }       
    }
}